<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>车型信息编辑</title>
<style type="text/css">
	table{
		width:100%;
		border: 1px solid black;
	}
	td,th{
		padding: 5px;
	}
	tr{
		line-height: 40px;
	}
	form{
		width:700px;
		margin: 0 auto;
	}
</style>
<script type="text/javascript" src="${basePath }/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="${basePath }/js/vendor/jquery.ui.widget.js"></script>
<script type="text/javascript" src="${basePath }/js/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="${basePath }/js/jquery.fileupload.js"></script>
<script type="text/javascript">
	$(function() {
		$('input[type="file"]').fileupload({
	        url: '${basePath}/fileupload',
	        dataType: 'json',
	        done: function (e, data) {
	        	var result = data._response.result;
	            if(result.isSuccess) {
	            	alert("上传成功！！");
	            	$(this).next().val("${basePath}/upload/"+result.msg);
	            } else {
	            	alert("上传失败！！");
	            }
	        }
	    })
	})
		
	function editCar() {
		$.ajax({
			url:"${basePath}/car/update",
			type:"post",
			data:$("form").serialize(),
			dataType:"json"
		}).done(function(data){
			alert(data.msg);
			if(data.isSuccess)
				window.location = "${basePath}/car/list";
		})
	}
</script>
</head>
<body>
	<h2 align="center">后台管理</h2>
	<hr>
	<form>
		<fieldset>汽车信息编辑</fieldset>
		<br>
		<table>
			<tr>
				<th>代码</th><td><input type="text" name="car.id" value="${car.id }" readonly="readonly"></td>
				<th>车名</th><td><input type="text" name="car.name" value="${car.name }"></td>
			</tr>
			<tr>
				<th>品牌</th><td><input type="text" name="car.pp" value="${car.pp }"></td>
				<th>车系</th><td><input type="text" name="car.cx" value="${car.cx }"></td>
			</tr>
			<tr>
				<th>年代款</th><td><input type="text" name="car.ndk" value="${car.ndk }"></td>
				<th>配置款</th><td><input type="text" name="car.pzk" value="${car.pzk }"></td>
			</tr>
			<tr>
				<th>座位数</th><td><input type="text" name="car.zws" value="${car.zws }"></td>
				<th>车门数</th><td><input type="text" name="car.cms" value="${car.cms }"></td>
			</tr>
			<tr>
				<th>燃料类型</th><td><input type="text" name="car.rllx" value="${car.rllx }"></td>
				<th>变速箱类型</th><td><input type="text" name="car.bsxlx" value="${car.bsxlx }"></td>
			</tr>
			<tr>
				<th>排量</th><td><input type="text" name="car.pl" value="${car.pl }"></td>
				<th>燃油标号</th><td><input type="text" name="car.rybh" value="${car.rybh }"></td>
			</tr>
			<tr>
				<th>驱动方式</th><td><input type="text" name="car.qdfs" value="${car.qdfs }"></td>
				<th>发动机进气方式</th><td><input type="text" name="car.fdjjqxs" value="${car.fdjjqfs }"></td>
			</tr>
			<tr>
				<th>天窗</th><td><input type="text" name="car.tc" value="${car.tc }"></td>
				<th>油箱容量</th><td><input type="text" name="car.yxrl" value="${car.yxrl }"></td>
			</tr>
			<tr>
				<th>音响</th><td><input type="text" name="car.yx" value="${car.yx }"></td>
				<th>座椅</th><td><input type="text" name="car.zy" value="${car.zy }"></td>
			</tr>
			<tr>
				<th>倒车雷达</th><td><input type="text" name="car.dcld" value="${car.dcld }"></td>
				<th>气囊</th><td><input type="text" name="car.qn" value="${car.qn }"></td>
			</tr>
			<tr>
				<th>DVD/CD</th><td><input type="text" name="car.dvdcd" value="${car.dvdcd }"></td>
				<th>GPS导航</th><td><input type="text" name="car.gps" value="${car.gps }"></td>
			</tr>
			<tr>
				<th>视频地址</th><td><input type="text" name="car.swf" value="${car.swf }"></td>
				<th>容纳人数</th><td><input type="text" name="carInfo.num" value="${carInfo.num }"></td>
			</tr>
			<tr>
				<th>描述词1</th><td><input type="text" name="carInfo.word1" value="${carInfo.word1 }"></td>
				<th>描述词2</th><td><input type="text" name="carInfo.word2" value="${carInfo.word2 }"></td>
			</tr>
			<tr>
				<th>描述词3</th><td><input type="text" name="carInfo.word3" value="${carInfo.word3 }"></td>
				<th>描述词4</th><td><input type="text" name="carInfo.word4" value="${carInfo.word4 }"></td>
			</tr>
			<tr>
				<th>图片1</th><td><input type="file" id="file1"><input type="text" name="carInfo.img1" value="${carInfo.img1 }" readonly="readonly"></td>
				<th>图片2</th><td><input type="file" id="file2"><input type="text" name="carInfo.img2" value="${carInfo.img2 }" readonly="readonly"></td>
			</tr>
			<tr>
				<th>图片3</th><td><input type="file" id="file3"><input type="text" name="carInfo.img3" value="${carInfo.img3 }" readonly="readonly"></td>
				<th>图片4</th><td><input type="file" id="file4"><input type="text" name="carInfo.img4" value="${carInfo.img4 }" readonly="readonly"></td>
			</tr>
			<tr>
				<th>图片5</th><td><input type="file" id="file5"><input type="text" name="carInfo.img5" value="${carInfo.img5 }" readonly="readonly"></td>
				<th>图片6</th><td><input type="file" id="file6"><input type="text" name="carInfo.img6" value="${carInfo.img6 }" readonly="readonly"></td>
			</tr>
			<tr>
				<th>图片7</th><td><input type="file" id="file7"><input type="text" name="carInfo.img7" value="${carInfo.img7 }" readonly="readonly"></td>
			</tr>
		</table>
		<br>
		<input type="hidden" name="carInfo.id" value="${carInfo.id }">
		<input type="button" value="保存" onclick="editCar();">
	</form>
</body>
</html>